//======================================================
// ET_MP_pantherbase by Tigerpanzer2003 & Dr.Diode =====
//            last update by Diode 26.01.04        =====
//======================================================

game_manager
{
	spawn
	{
//		accum 2 set 1	
		wm_axis_respawntime 20
		wm_allied_respawntime 20
		wm_number_of_objectives 7
		wm_set_round_timelimit 30
		
		// Objectives
		// 1: Aufmunitionieren/Verladen und Abtransport  der Panzer
		//Secondary
		// 2: Verteidigung /Zertörung Krane 
		// 3: Aufmunitionieren des Panzers/Verhindern des Aufmunitionierens
		// 4: Rampe errichten/Rampe zerstören
		// 5: Signal für Abfahrt setzen/Besetzen der Signaleinrichtung
		// 6: Allied command post
		// 7: Axis command post

		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_set_main_objective		1	0
		wm_set_main_objective		1	1

		wm_objective_status 1 0 0          //0=default
		wm_objective_status 1 1 0          //1=succeeded
		wm_objective_status 2 0 0          //2=failed
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0
		

		
		
		// Stopwatch mode defending team (0=Axis, 1=Allies)
		wm_set_defending_team	0

		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0
		
		// start triggered loops on/off as required (eg: command post radio sounds)
		disablespeaker allies_compost_sound
		disablespeaker axis_compost_sound
		
		wait 500
		construct ramp
		setstate tank invisible
		setstate ramp_materials invisible
		setstate ramp_materials_clip invisible
		setstate ramp_flag invisible
		
		trigger tank enable_stage6

		setstate ramp_teeth default
								
	}
	
	trigger train_drive_enable
	{		
		accum 2 set 0
	}
	
		
	trigger train_drive
	{
		accum 2 abort_if_not_equal 0
		// UI pop-up to alert players
		wm_announce	"Allies have destroyed the gun tracking"

		wm_objective_status 1 0 1
		wm_objective_status 1 1 2

		accum 1 set 1				// End of game completed

		// Call function to check if the round has been won
		trigger game_manager checkgame
	}
	
	trigger checkgame
	{
		accum 1 abort_if_not_equal 1

		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 0

		// End the round
		wm_endround
		wait 4000
		trigger signal open
		wait 2000
		playsound sound/panther/train_end.wav volume 192
	}
}

train_start
{
	spawn
	{
		accum 2 bitset 0
	}
	
	trigger enable
	{
		accum 2 bitset 1
	}
	
	trigger endgame
	{
		accum 2 abort_if_not_bitset 1
		wait 500
		trigger signal_button move
	}
}

signal_button
{
	spawn
	{
		accum 2 bitset 0
	}
	
	trigger move
	{
		accum 2 abort_if_not_bitset 0
		accum 2 bitset 1
		faceangles 0 0 30 1000
		playsound sound/maps/track_switch.wav volume 192
		wait 2000
		trigger game_manager train_drive
	}
}
		
tank_sound
{
	trigger start
	{
		trigger tank sound_start
		wait 3400
		trigger tank sound_move
	}

	trigger stop
	{
		trigger tank sound_stop
		wait 1400
		trigger tank sound_idle
	}

	trigger rebirth
	{
		trigger tank sound_rebirth
		wait 1400
		trigger tank sound_idle
	}
}

//======================================Tankstuff===============================================

tank
{
	spawn
	{
		wait 400
		followspline 0 spln1 50000 length 32 wait

		trigger tank sound_idle
		trigger tank tracks_stop
	}

	// ========================================
	// sound stuff

	trigger sound_idle
	{
		stopsound
		playsound sound/vehicles/tank/tank_idle.wav looping volume 512
	}

	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/tank/tank_revup.wav volume 196
	}

	trigger sound_move
	{
		stopsound
		playsound sound/vehicles/tank/tank_move.wav looping volume 512
	}

	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/tank/tank_revdown.wav volume 196
	}

	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/tank/tank_stop.wav volume 256
	}

	trigger sound_rebirth
	{
		stopsound
		playsound sound/vehicles/tank/tank_start.wav volume 196
	}

	// ========================================
	// ========================================


// ===========================================================================================
// ===========================================================================================
	trigger tracks_forward
	{
		accum 0 abort_if_equal 1
		accum 0 set 1

		remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_forward

		remapshaderflush
	}

	trigger tracks_stop
	{
		accum 0 abort_if_equal 0
		accum 0 set 0

		remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_left
		remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_right
		remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_left
		remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_right
		remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_left
		remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_right

		remapshaderflush
	}

	trigger tracks_turn_left
	{
		accum 0 abort_if_equal 2
		accum 0 set 2

		remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_backward
		remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_backward
		remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_backward
		remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_forward

		remapshaderflush
	}

	trigger tracks_turn_right
	{
		accum 0 abort_if_equal 3
		accum 0 set 3

		remapshader models/mapobjects/tanks_sd/jag_tracks_left 	models/mapobjects/tanks_sd/jag_tracks_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_tracks_right models/mapobjects/tanks_sd/jag_tracks_alt_backward
		remapshader models/mapobjects/tanks_sd/jag_wheels_left 	models/mapobjects/tanks_sd/jag_wheels_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_wheels_right models/mapobjects/tanks_sd/jag_wheels_alt_backward
		remapshader models/mapobjects/tanks_sd/jag_cogs_left 	models/mapobjects/tanks_sd/jag_cogs_alt_forward
		remapshader models/mapobjects/tanks_sd/jag_cogs_right 	models/mapobjects/tanks_sd/jag_cogs_alt_backward

		remapshaderflush
	}

// ===========================================================================================
// ===========================================================================================

	trigger run_continue
	{
		accum 3 inc 1
		trigger self deathcheck
		trigger self stopcheck
		trigger self move
	}


// ===========================================================================================
// movement

	trigger move_check
	{
		trigger self stuck_check
		//accum 1 abort_if_bitset 3

		trigger self dispatch
	}

	trigger move
	{
		trigger self move_check

		wait 500

		trigger self move
	}

	trigger dispatch
	{
		accum 3 trigger_if_equal 0 tank run_0
		accum 3 trigger_if_equal 1 tank run_1
		accum 3 trigger_if_equal 2 tank run_2
		accum 3 trigger_if_equal 3 tank run_3
		accum 3 trigger_if_equal 4 tank run_4
		accum 3 trigger_if_equal 5 tank run_5
		accum 3 trigger_if_equal 6 tank run_6
		accum 3 trigger_if_equal 7 tank run_7
		accum 3 trigger_if_equal 8 tank run_8
		accum 3 trigger_if_equal 9 tank run_9
		accum 3 trigger_if_equal 10 tank run_10
		accum 3 trigger_if_equal 11 tank run_11
		accum 3 trigger_if_equal 12 tank run_12
		accum 3 trigger_if_equal 13 tank run_13
		accum 3 trigger_if_equal 14 tank run_14
		accum 3 trigger_if_equal 15 tank run_15
		accum 3 trigger_if_equal 16 tank run_16
		accum 3 trigger_if_equal 17 tank run_17
		accum 3 trigger_if_equal 18 tank run_18
		accum 3 trigger_if_equal 19 tank run_19
		accum 3 trigger_if_equal 20 tank run_20
		accum 3 trigger_if_equal 21 tank run_21
		accum 3 trigger_if_equal 22 tank run_22
		accum 3 trigger_if_equal 23 tank run_23
		accum 3 trigger_if_equal 24 tank run_24
		accum 3 trigger_if_equal 25 tank run_25
		accum 3 trigger_if_equal 26 tank run_26
		accum 3 trigger_if_equal 27 tank run_27
		accum 3 trigger_if_equal 28 tank run_28
		accum 3 trigger_if_equal 29 tank run_29
		accum 3 trigger_if_equal 30 tank run_30
		accum 3 trigger_if_equal 31 tank run_31
		accum 3 trigger_if_equal 32 tank run_32
		accum 3 trigger_if_equal 33 tank run_33
		accum 3 trigger_if_equal 34 tank run_34
		accum 3 trigger_if_equal 35 tank run_35
		accum 3 trigger_if_equal 36 tank run_36
		accum 3 trigger_if_equal 37 tank run_37
		accum 3 trigger_if_equal 38 tank run_38
		accum 3 trigger_if_equal 39 tank run_39
		accum 3 trigger_if_equal 40 tank run_40
		accum 3 trigger_if_equal 41 tank run_41
		accum 3 trigger_if_equal 42 tank run_42
		accum 3 trigger_if_equal 43 tank run_43
		accum 3 trigger_if_equal 44 tank run_44
		accum 3 trigger_if_equal 45 tank run_45
		accum 3 trigger_if_equal 46 tank run_46
		accum 3 trigger_if_equal 47 tank run_47
		accum 3 trigger_if_equal 48 tank run_48
		accum 3 trigger_if_equal 49 tank run_49
		accum 3 trigger_if_equal 50 tank run_50
		accum 3 trigger_if_equal 51 tank run_51
		accum 3 trigger_if_equal 52 tank run_52
		accum 3 trigger_if_equal 53 tank run_53
	}

	trigger run_0
	{
		trigger self tracks_forward
		accum 1 bitset 2
		followspline 0 spln2 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_1
	{
		trigger self tracks_forward
		trigger game_manager allies_steal_tank

		accum 1 bitset 2
		followspline 0 spln3 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_2
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln4 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_3
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln5 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_4
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln6 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_5
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln7 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_6
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln8 40 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_7
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln9 40 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_8
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln10 40 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_9
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln11 40 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_10
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln12 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_11
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln13 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_12
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln14 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_13
	{
		trigger self tracks_turn_right

		accum 1 bitset 2
		followspline 0 spln15 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_14
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln16 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_15
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln17 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_16
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln18 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_17
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln19 50 wait length 32
		accum 1 bitreset 2
		
		trigger crane run_continue

		trigger self run_continue
	}

	trigger run_18
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln20 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_19
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln21 50 wait length 32
		accum 1 bitreset 2
		
		trigger tank stuck_check_barrier1_built_msg
		
		trigger self run_continue
	}

	trigger run_20
	{
		trigger self tracks_forward
		
		accum 1 bitset 2
		followspline 0 spln22 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_21
	{
		trigger self tracks_forward
		
		// **********************************
		trigger defense1 remove
		// **********************************
		
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "pa_axis_tank_barrier1"

		wm_teamvoiceannounce 0 "pa_allies_tank_barrier1"
		// *---------------------------------------------------------------------------------*

		accum 1 bitset 2
		followspline 0 spln23 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_22
	{
		trigger self tracks_forward
		
		accum 1 bitset 2
		followspline 0 spln24 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_23
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln25 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_24
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln26 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_25
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln27 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_26
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln28 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_27
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln29 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_28
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln30 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_29
	{
		trigger self tracks_forward
		

		accum 1 bitset 2
		followspline 0 spln31 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_30
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln32 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_31
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln33 80 wait length 32
		accum 1 bitreset 2
		
		trigger tank stuck_check_barrier2_built_msg

		trigger self run_continue
	}

	trigger run_32
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln34 80 wait length 32
		accum 1 bitreset 2
				
		trigger self run_continue
	}

	trigger run_33
	{
		trigger self tracks_forward
		
		// **********************************
		trigger defense2 remove
		// **********************************
		
		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "pa_axis_tank_barrier2"

		wm_teamvoiceannounce 0 "pa_allies_tank_barrier2"
		// *---------------------------------------------------------------------------------*

		accum 1 bitset 2
		followspline 0 spln35 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_34
	{
		trigger self tracks_forward
		
		accum 1 bitset 2
		followspline 0 spln36 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_35
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln37 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_36
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln38 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_37
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln39 80 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_38
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln40 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_39
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln41 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_40
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln42 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_41
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln43 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_42
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln44 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_43
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln45 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_44
	{
		trigger self tracks_forward
		
		accum 1 bitset 2
		followspline 0 spln46 50 wait length 32
		accum 1 bitreset 2
		
		trigger tank stuck_check_ramp_built_msg

		trigger self run_continue
	}

	trigger run_45
	{
		trigger self tracks_turn_left

		accum 1 bitset 2
		followspline 0 spln47 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_46
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln48 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_47
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln49 50 wait length 32
		accum 1 bitreset 2
		
		//****************************************************
		trigger ramp remove
		//****************************************************

		trigger self run_continue
	}

	trigger run_48
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln50 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_49
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln51 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_50
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln52 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_51
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln53 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_52
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln54 50 wait length 32
		accum 1 bitreset 2

		trigger self run_continue
	}

	trigger run_53
	{
		trigger self tracks_forward

		accum 1 bitset 2
		followspline 0 spln55 50 wait length 32
		accum 1 bitreset 2
		
		trigger self script_lockout
				
		trigger self 		tracks_stop
		trigger tank_sound 	stop
		
		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom
		
		wm_objective_status 5 0 1
		wm_objective_status 5 1 2
				
		accum 3 inc 1
        wait 3000
        trigger train train_on
        trigger game_manager train_drive_enable
        trigger train_start enable

	}

	

	
// ===========================================================================================
// ===========================================================================================

// ===========================================================================================
// stuck checking
// digibob: since we cant return variables, just use bit 3 of accum 1 as a register... mmmm assembly...
	trigger stuck_check
	{
		accum 1 bitreset 3

		trigger self stuck_check_barrier1_built
		trigger self stuck_check_barrier2_built
		trigger self stuck_check_ramp_built
		trigger self stuck_check_crane
		trigger self stuck_check_scriptlockout
		trigger self stuck_check_finished
	}

	trigger stuck_check_finished
	{
		accum 3 abort_if_less_than 77

		accum 1 bitset 3
	}

	trigger stuck_check_scriptlockout
	{
		accum 5 abort_if_equal 0

		accum 1 bitset 3
	}

	trigger stuck_check_barrier1_built
	{
		accum 3 abort_if_not_equal 21

		accum 1 abort_if_not_bitset 0

		accum 1 bitset 3
	}

	trigger stuck_check_barrier1_built_msg
	{
		accum 1 abort_if_not_bitset 0

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "pa_allies_tankbar_destroy"
		// *---------------------------------------------------------------------------------*
	}

	trigger stuck_check_barrier2_built
	{
		accum 3 abort_if_not_equal 32

		accum 1 abort_if_not_bitset 1

		accum 1 bitset 3
	}

	trigger stuck_check_barrier2_built_msg
	{
		accum 1 abort_if_not_bitset 1

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "pa_allies_tankbar_destroy"
		// *---------------------------------------------------------------------------------*
	}
	
	trigger stuck_check_ramp_built
	{
		accum 3 abort_if_not_equal 46
		
		accum 1 abort_if_bitset 10
		
		accum 1 bitset 3
	}
	
	trigger stuck_check_ramp_built_msg
	{
		accum 1 abort_if_bitset 10
	}
	
	trigger stuck_check_crane
	{
		accum 3 abort_if_not_equal 19
		accum 1 abort_if_bitset 11
		accum 1 bitset 3
	}
		

// ===========================================================================================
// stop check

	trigger stopcheck_setup
	{
		accum 1 bitset 6			// stop if we're stuck/no-one's pushing :)

		accum 1 abort_if_bitset 8		// no one in the trigger, abort

		trigger self stuck_check		// call the stop check function
		accum 1 abort_if_bitset 3		// we're stuck so break out

		accum 1 bitreset 6			// we're free to move
	}

	trigger stopcheck
	{
		trigger self stopcheck_setup
		accum 1 abort_if_not_bitset 6

		trigger self script_lockout

		// Any just stopped moving stuff goes here
		trigger tank_sound 	stop
		trigger self 		tracks_stop
		startanimation 45 	10 	15 nolerp norandom
		wait 666
		startanimation 0 	1 	15 nolerp norandom
		wait 900

		trigger self script_lockout_stop
		resetscript
	}

// ===========================================================================================
// ===========================================================================================
// script lockouts

	trigger script_lockout
	{
		accum 5 inc 1
	}

	trigger script_lockout_stop
	{
		accum 5 inc -1
	}

// ===========================================================================================
// ===========================================================================================
// enable/disable

	trigger tank_enable
	{
		trigger self stuck_check
		accum 1 abort_if_bitset 3 	// stuck check

		accum 4 set 0				// reset stop counter
		accum 1 bitreset 8			// reset stop check

		accum 1 abort_if_bitset 2 	// already following spline
		accum 5 abort_if_not_equal 0	// are we not in a script lockout?

		accum 1 abort_if_bitset 7 	// death check

		// Any just started moving stuff goes here

		trigger self script_lockout

		trigger tank_sound start

		startanimation 55 10 15 nolerp norandom
		wait 666
		startanimation 5 40 15 nolerp norandom
		wait 500
		trigger self tracks_forward

		trigger self script_lockout_stop

		trigger self move
	}

	trigger tank_disable
	{
		accum 4 inc 1				// up the stop counter
		accum 4 abort_if_less_than 4

		accum 1 bitset 8			// set stop check

		trigger self deathcheck
	}

// ===========================================================================================
// ===========================================================================================
// death / rebirth

	rebirth
	{
		accum 1 bitreset 9 // we're visibly alive
		accum 1 bitreset 7 // we're alive again

		trigger self script_lockout

		changemodel models/mapobjects/tanks_sd/jagdpanther_africa_tracks.md3

		setstate tank_smoke invisible

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "axis_hq_tank_stop"

		wm_teamvoiceannounce 1 "axis_hq_tank_repaired_allies"

		wm_teamvoiceannounce 0 "allies_hq_tank_repaired"

		wm_removeteamvoiceannounce 0 "allies_hq_tank_damaged_axis"
		// *---------------------------------------------------------------------------------*

		trigger tank_sound rebirth
		wait 500

		trigger self script_lockout_stop
	}

	death
	{
		accum 1 bitset 7
	}

	trigger deathcheck
	{
		accum 1 abort_if_not_bitset 7	// are we dead?
		accum 1 abort_if_bitset 9		// are we not already visibly dead?
		accum 1 abort_if_bitset 2		// are we not following a spline?
		accum 5 abort_if_not_equal 0	// are we not in a script lockout?

		accum 1 bitset 9				// we're now visibly dead

		trigger self deathcheck_message
		accum 1 bitset 4

		changemodel models/mapobjects/tanks_sd/jagdpanther_africa_tracks2.md3

		setstate tank_smoke default

		kill tank_construct

		trigger self sound_death
		trigger self tracks_stop

		trigger self script_lockout

		trigger self tracks_stop
		startanimation 45 10 15 nolerp norandom
		wait 666
		startanimation 0 1 15 nolerp norandom

		trigger self script_lockout_stop

		resetscript
	}

	trigger deathcheck_message
	{
		accum 1 abort_if_not_bitset 4

		wm_announce "The Tank has been damaged!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "allies_hq_tank_damaged_axis"

		wm_teamvoiceannounce 1 "axis_hq_tank_damaged"

		wm_teamvoiceannounce 0 "allies_hq_tank_damaged_axis"

		wm_removeteamvoiceannounce 1 "axis_hq_tank_stop"
		// *---------------------------------------------------------------------------------*
	}

	trigger startfire
	{
		startanimation 67 8 10 nolerp norandom noloop
	}

	trigger stopfire
	{
		startanimation 0 1 15 nolerp norandom
	}

	trigger enable_stage2
	{
		accum 1 bitreset 0
	}

	trigger disable_stage2
	{
		accum 1 bitset 0
	}

	trigger enable_stage4
	{
		accum 1 bitreset 1
	}

	trigger disable_stage4
	{
		accum 1 bitset 1
	}
	
	trigger enable_stage6
	{
		accum 1 bitset 10
	}
	
	trigger disable_stage6
	{
		accum 1 bitreset 10
	} 
	
	trigger enable_crane
	{
		accum 1 bitset 11
	}
}

tank_trigger
{
	spawn
	{
		wait 500

		attachtotag tank_shell tag_turret

		trigger tank_trigger bot_goal_loop
	}

	trigger bot_goal_loop
	{
		wait 4000	// check every 4 seconds
		trigger tank bot_active_check
		trigger tank_trigger bot_goal_loop
	}
}

tank_build
{
	spawn
	{
		wait 500

		attachtotag tank_shell tag_turret
	}
}

tank_construct
{
	spawn
	{
		wait 1000

		constructible_class 2
		constructible_health 1200
		constructible_constructxpbonus 10
		constructible_destructxpbonus 10
	}

	built final
	{
		alertentity tank

		wm_announce "The Tank has been repaired!"
	}
}

tank_shell
{
	spawn
	{
		wait 400
		attachtotag tank tag_tank
	}
}

tank_turret
{
	spawn
	{
		wait 500

		attachtotag tank_shell tag_turret
	}

	trigger turn ////////////nicht benutzt
	{
		wait 1000

		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 340 0 3000
		stopsound
		playsound sound/vehicles/tank/turret_end.wav

		wait 500

		trigger tank startfire
		playsound sound/vehicles/tank/tank_fire.wav
		trigger boomtrigger boom_all		// triggers the hurts around bank explosions (each has its own wait for timing)
		trigger tank_flash run
	}

	trigger blow_doors
	{
		setstate tank_flash invisible

		wait 200
		trigger tank stopfire

		alertentity bank_door1
		setstate doorframe invisible
		setstate doorframe_damaged default

		wm_announce "Allied team has destroyed the Bank Doors!"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		wm_set_main_objective		4	0
		wm_set_main_objective		4	1

		wait 100
		trigger bank_door2_damaged bankbackboom

		playsound sound/vehicles/tank/turret_spin.wav looping
		faceangles 0 0 0 3000
		stopsound
		playsound sound/vehicles/tank/turret_end.wav
		trigger tank sound_death
		trigger tank script_lockout_stop
	}
}

tank_disabler
{
	trigger run
	{
		trigger tank tank_disable
	}
}

tank_enabler
{
	trigger run
	{
		trigger tank tank_enable
	}
}

tank_smoke
{
	spawn
	{
		wait 300
		attachtotag tank_shell tag_smoke
		setstate tank_smoke invisible
	}
}

fan_out
{
	spawn
	{
		wait 50
		setrotation	-1200 0 0
	}
}

fan_in
{
	spawn
	{
		wait 50
		setrotation	-600 0 0
	}
}

signal
{
	spawn
	{
		trigger self close
	}

	trigger close
	{
		faceangles 0 0 0 2000
	}

	trigger open
	{
		faceangles -45 0 0 2000
		
		playsound sound/maps/track_move.wav volume 300
	}
}


//=====================================Lights==========================================
light_on
{
	spawn
	{
		trigger light_on auto
	}
	
	trigger auto
	{
		trigger light_on active
		trigger light_off noacitve wait
		wait 1000
		trigger light_on noactive
		trigger light_off active wait
		wait 1000
		trigger light_on auto
	}
	
	trigger active
	{
		setstate light_on default
	}
	
	trigger noactive
	{
		setstate light_on invisible
	}
	
}

light_off
{
	trigger active
	{
		setstate light_off default
	}
	
	trigger noactive
	{
		setstate light_off invisible
	}
}


light_on_01
{
	spawn
	{
		trigger light_on_01 auto
	}
	
	trigger auto
	{
		trigger light_on_01 active
		trigger light_off_01 noacitve wait
		wait 1000
		trigger light_on_01 noactive
		trigger light_off_01 active wait
		wait 1000
		trigger light_on_01 auto
	}
	
	trigger active
	{
		setstate light_on_01 default
	}
	
	trigger noactive
	{
		setstate light_on_01 invisible
	}
	
}

light_off_01
{
	trigger active
	{
		setstate light_off_01 default
	}
	
	trigger noactive
	{
		setstate light_off_01 invisible
	}
}

light_on_02
{
	spawn
	{
		trigger light_on_02 auto
	}
	
	trigger auto
	{
		trigger light_on_02 active
		trigger light_off_02 noacitve wait
		wait 300
		trigger light_on_02 noactive
		trigger light_off_02 active wait
		wait 300
		trigger light_on_02 auto
	}
	
	trigger active
	{
		setstate light_on_02 default
	}
	
	trigger noactive
	{
		setstate light_on_02 invisible
	}
	
}

light_off_02
{
	trigger active
	{
		setstate light_off_02 default
	}
	
	trigger noactive
	{
		setstate light_off_02 invisible
	}
}

light_on_03
{
	spawn
	{
		trigger light_on_03 auto
	}
	
	trigger auto
	{
		trigger light_on_03 active
		trigger light_off_03 noacitve wait
		wait 500
		trigger light_on_03 noactive
		trigger light_off_03 active wait
		wait 500
		trigger light_on_03 auto
	}
	
	trigger active
	{
		setstate light_on_03 default
	}
	
	trigger noactive
	{
		setstate light_on_03 invisible
	}
	
}

light_off_03
{
	trigger active
	{
		setstate light_off_03 default
	}
	
	trigger noactive
	{
		setstate light_off_03 invisible
	}
}

light_on_04
{
	spawn
	{
		trigger light_on_04 auto
	}
	
	trigger auto
	{
		trigger light_on_04 active
		trigger light_off_04 noacitve wait
		wait 500
		trigger light_on_04 noactive
		trigger light_off_04 active wait
		wait 500
		trigger light_on_04 auto
	}
	
	trigger active
	{
		setstate light_on_04 default
	}
	
	trigger noactive
	{
		setstate light_on_04 invisible
	}
	
}

light_off_04
{
	trigger active
	{
		setstate light_off_04 default
	}
	
	trigger noactive
	{
		setstate light_off_04 invisible
	}
}

//===========================Maschinen========================================================

welle
{
	spawn
	{
		wait 50
		setrotation	-8500 0 0
	}
}

welle_01
{
	spawn
	{
		wait 50
		setrotation	-9000 0 0
	}
}

welle_02
{
	spawn
	{
		wait 50
		setrotation	-9500 0 0
	}
}

welle_03
{
	spawn
	{
		wait 50
		setrotation	-8500 0 0
	}
}




//======================Munitionsdepot======================================================

smoke_lift
{
	spawn
	{
		wait 300
		setstate smoke_lift invisible
	}
}

liftsteering_damage
{
	spawn
	{
		wait 300
		setstate liftsteering_damage invisible
	}
	
	trigger disable
	{
		setstate liftsteering_damage invisible
		setstate smoke_lift invisible
		trigger crane enable
	}
	
	trigger enable
	{
		setstate liftsteering_damage default
		setstate smoke_lift default
		trigger crane disable
	}
}

liftsteering
{
	spawn
	{
		wait 400
		trigger liftsteering setup
		constructible_class 2
	}
	
	trigger setup
	{
		setstate liftsteering_teeth invisible
	}
	
	buildstart final
	{
		setstate liftsteering_teeth underconstruction
	}

	built final
	{
		trigger liftsteering_damage disable
         
		setstate liftsteering_teeth default
		
		wm_objective_status 2 0 1          
		wm_objective_status 2 1 0
		
		wm_announce "The Liftcontroller has been constructed."
	}
	
	decayed final
	{
		trigger liftsteering_damage enable		
		setstate liftsteering_teeth invisible
	}

	death
	{
		setstate liftsteering_teeth invisible
		trigger liftsteering_damage enable
		
		wm_objective_status 2 0 2          //2=failed
		wm_objective_status 2 1 1
		
		wm_announce "The Liftcontroller has been destroyed."
		
	}
	
	trigger remove
	{
		trigger liftsteering_damage disable
		setstate liftsteering_teeth default
	}
}

	

//===========================Rampe==========================================================

ramp  
{
	spawn
	{
		trigger ramp setup
		constructible_class 3
	}
	
	trigger setup
	{
		setstate ramp_materials default
		setstate ramp_materials_clip default
		setstate ramp_flag default


		setstate ramp_teeth invisible
	}
	
	buildstart final
	{
		setstate ramp_materials default
		setstate ramp_materials_clip default
		setstate ramp_flag default


		setstate ramp_teeth underconstruction
	}

	built final
	{
		setstate ramp_materials invisible
		setstate ramp_materials_clip invisible
		setstate ramp_flag invisible
		
		wm_objective_status 4 0 1
		wm_objective_status 4 1 2
		
		trigger tank enable_stage6

		setstate ramp_teeth default
	}
	
	decayed final
	{
		setstate ramp_materials default
		setstate ramp_materials_clip default
		setstate ramp_flag default
		
		setstate ramp_teeth invisible
	}

	death
	{
		setstate ramp_materials default
		setstate ramp_materials_clip default
		setstate ramp_flag default
		
		wm_objective_status 4 0 2
		wm_objective_status 4 1 1
		
        trigger tank disabler_stage6

		setstate ramp_teeth invisible
		wm_announce "The Tank Ramp has been destroyed."
		
	}
	
	trigger remove
	{
		setstate ramp_toi invisible
		setstate ramp_materials invisible
		setstate ramp_materials_clip invisible
		setstate ramp_flag invisible
		setstate ramp_teeth default
	}
}

//==============================Barriere 1===========================================

defense1
{
	spawn
	{
		wait 400
		trigger defense1 setup

		constructible_class 3
	}

	trigger setup
	{
		setstate defense1_materials default
		setstate defense1_materials_clip default
		setstate defense1_flag default


		setstate defense1_teeth invisible
	}

	buildstart final
	{
		setstate defense1_materials default
		setstate defense1_materials_clip default
		setstate defense1_flag default


		setstate defense1_teeth underconstruction
	}

	built final
	{
		setstate defense1_materials invisible
		setstate defense1_materials_clip invisible
		setstate defense1_flag invisible


		setstate defense1_teeth default

		trigger tank disable_stage2

		wm_announce "Tank Barrier #1 has been constructed."

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "pa_axis_tankbar_constructed"

		wm_removeteamvoiceannounce 1 "pa_axis_tankbar_construct"
		wm_removeteamvoiceannounce 1 "pa_axis_tankbars_construct"
		// *---------------------------------------------------------------------------------*
	}

	decayed final
	{
		setstate defense1_materials default
		setstate defense1_materials_clip default
		setstate defense1_flag default


		setstate defense1_teeth invisible
	}

	death
	{
		setstate defense1_materials default
		setstate defense1_materials_clip default
		setstate defense1_flag default


		setstate defense1_teeth invisible

		trigger tank enable_stage2

		wm_announce "Tank Barrier #1 has been destroyed."

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "pa_axis_tankbar_construct"

		wm_teamvoiceannounce 1 "pa_axis_tankbar_destroyed"

		wm_teamvoiceannounce 0 "pa_allies_tankbar_destroyed"
		// *---------------------------------------------------------------------------------*
	}

	trigger remove
	{
		setstate defense1_toi invisible
		setstate defense1_materials invisible
		setstate defense1_materials_clip invisible
		setstate defense1_flag invisible
		setstate defense1_teeth invisible
		
		// *----------------------------------- vo ------------------------------------------*
		wm_removeteamvoiceannounce 1 "pa_axis_tankbar_construct"
		wm_removeteamvoiceannounce 1 "pa_axis_tankbars_construct"

		wm_removeteamvoiceannounce 0 "pa_allies_tankbar_destroy"
		wm_removeteamvoiceannounce 0 "pa_allies_tankbars_destroy"
		// *---------------------------------------------------------------------------------*

		remove
	}
}

//========================Barriere 2===============================================================
defense2
{
	spawn
	{
		wait 400
		trigger defense2 setup

		constructible_class 3
	}

	trigger setup
	{
		setstate defense2_materials default
		setstate defense2_materials_clip default
		setstate defense2_flag default


		setstate defense1_teeth invisible
	}

	buildstart final
	{
		setstate defense2_materials default
		setstate defense2_materials_clip default
		setstate defense2_flag default


		setstate defense2_teeth underconstruction
	}

	built final
	{
		setstate defense2_materials invisible
		setstate defense2_materials_clip invisible
		setstate defense2_flag invisible


		setstate defense2_teeth default

		trigger tank disable_stage4

		wm_announce "Tank Barrier #1 has been constructed."

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 1 "pa_axis_tankbar_constructed"

		wm_removeteamvoiceannounce 1 "pa_axis_tankbar_construct"
		wm_removeteamvoiceannounce 1 "pa_axis_tankbars_construct"
		// *---------------------------------------------------------------------------------*
	}

	decayed final
	{
		setstate defense2_materials default
		setstate defense2_materials_clip default
		setstate defense2_flag default


		setstate defense2_teeth invisible
	}

	death
	{
		setstate defense2_materials default
		setstate defense2_materials_clip default
		setstate defense2_flag default


		setstate defense2_teeth invisible

		trigger tank enable_stage4

		wm_announce "Tank Barrier #1 has been destroyed."

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 1 "pa_axis_tankbar_construct"

		wm_teamvoiceannounce 1 "pa_axis_tankbar_destroyed"

		wm_teamvoiceannounce 0 "pa_allies_tankbar_destroyed"
		// *---------------------------------------------------------------------------------*
	}

	trigger remove
	{
		setstate defense2_toi invisible
		setstate defense2_materials invisible
		setstate defense2_materials_clip invisible
		setstate defense2_flag invisible
		setstate defense2_teeth invisible
		
		// *----------------------------------- vo ------------------------------------------*
		wm_removeteamvoiceannounce 1 "pa_axis_tankbar_construct"
		wm_removeteamvoiceannounce 1 "pa_axis_tankbars_construct"

		wm_removeteamvoiceannounce 0 "pa_allies_tankbar_destroy"
		wm_removeteamvoiceannounce 0 "pa_allies_tankbars_destroy"
		// *---------------------------------------------------------------------------------*

		remove
	}
}

///===================Trainsound===================================

train
{
        trigger train_on
        {
              togglespeaker train_main
              wait 200
              togglespeaker train01
              wait 200
              togglespeaker train02
              wait 200
              togglespeaker train03
              wait 500
              togglespeaker train04
        }
} 


//===================Kranstuff=====================================
//============================================================

///------------------Sound----------------------------------

krane_sound 
{
	trigger crane_start
	{
		trigger crane crane_start
		wait 250
		trigger crane crane_loop
	}

	trigger crane_stop
	{
		trigger crane crane_stop
	}

	trigger hook_start
	{
		trigger crane hook_start
		wait 700
		trigger crane hook_loop
	}

	trigger hook_stop
	{
		trigger crane hook_stop
	}
}

active_crane
{
        trigger active_start
        {
                togglespeaker active
                
        }
}

horn
{
        

	trigger horn_start
	{
		togglespeaker alarm
	}
	
	trigger horn_end
	{
		togglespeaker alarm
	}
}
		





///----------------------Movement------------------------------------

crane
{
	spawn
	{
		accum 2 bitset 0 /// off/on
	}
	
		
	trigger crane_start
	{
		stopsound
		playsound sound/movers/motors/motor_start_02.wav volume 96
	}

	trigger crane_loop
	{
		playsound sound/movers/motors/motor_loop_02.wav looping 
	}

	trigger crane_stop
	{
		stopsound
		playsound sound/movers/motors/motor_end_02.wav volume 96
	}
	trigger hook_start
	{
		stopsound
		playsound sound/movers/motors/motor_start_01.wav volume 96
	}

	trigger hook_loop
	{
		playsound sound/movers/motors/motor_loop_01.wav looping
	}

	trigger hook_stop
	{
		stopsound
		playsound sound/movers/motors/motor_end_01.wav volume 96
	}
	
	trigger run_continue
	{
		accum 3 inc 1
		trigger self move
	}
	
	trigger move
	{
		trigger self move_check
		wait 500
		trigger self move
	}
	
	trigger move_check
	{
		accum 2 abort_if_not_bitset 0
		
		trigger self dispatch
	}
	
	trigger dispatch
	{
		accum 3 trigger_if_equal 1 crane move_up
		accum 3 trigger_if_equal 2 crane move_left
		accum 3 trigger_if_equal 3 crane move_left_down
		accum 3 trigger_if_equal 4 crane move_left_up
		accum 3 trigger_if_equal 5 crane move_right
		accum 3 trigger_if_equal 6 crane move_down
	}
	
	trigger disable
	{
		accum 2 bitreset 0
	}
	
	trigger enable
	{
		accum 2 bitset 0
	}
	
	trigger move_up
	{
		accum 2 abort_if_not_bitset 0
        wait 6000
        trigger active_crane active_start
        trigger krane_sound crane_start
		trigger horn horn_start
		trigger lift_ground move_ground_up
		
		trigger lift_st1 move_st1_up 
		trigger lift_st2 move_st2_up
		 
		trigger lift_st3 move_st3_up 
		trigger lift_st4 move_st4_up
		 
		trigger lift_st5 move_st5_up
		trigger lift_st6 move_st6_up
		
		trigger lift_st7 move_st7_up
		trigger muni up
							
	}
	
	trigger move_up_left
	{
		accum 2 abort_if_not_bitset 0
		trigger krane_sound crane_start
		trigger lift_ground move_ground_up_left
		
		trigger lift_st1 move_st1_up_left
		trigger lift_st2 move_st2_up_left
		
	}
		
	
	trigger move_down
	{
		accum 2 abort_if_not_bitset 0
		trigger krane_sound crane_start
		trigger lift_ground move_ground_down
		
		trigger lift_st1 move_st1_down
		trigger lift_st2 move_st2_down
		
		trigger lift_st3 move_st3_down
		trigger lift_st4 move_st4_down
		
		trigger lift_st5 move_st5_down
		trigger lift_st6 move_st6_down
		
		trigger lift_st7 move_st7_down
        trigger tank enable_crane
        
        wm_objective_status 3 0 1
		wm_objective_status 3 1 2
                
	}
	
	trigger move_down_left
	{
		accum 2 abort_if_not_bitset 0
		trigger krane_sound crane_start
		trigger lift_ground move_ground_down_left
		
		trigger lift_st1 move_st1_down_left
		trigger lift_st2 move_st2_down_left
		
		trigger muni down
	}
	
	trigger move_left
	{
		accum 2 abort_if_not_bitset 0
		trigger krane_sound hook_start
		trigger lift_krane lift_krane_left
		
		trigger lift_ground move_ground_left
		trigger lift_st1 move_st1_left
		
		trigger lift_st2 move_st2_left
		trigger muni left
	}
	
	trigger move_right
	{	
		accum 2 abort_if_not_bitset 0	
		trigger krane_sound hook_start
		trigger lift_krane lift_krane_right
		
		trigger lift_ground move_ground_right
		trigger lift_st1 move_st1_right
		trigger lift_st2 move_st2_right
	}
	
	
}

//-----------------------Physis--------------------------------------

lift_krane
{
	trigger lift_krane_left
	{
		gotomarker pos2 50 wait
	}
	
	trigger lift_krane_right
	{
		gotomarker pos1 50 wait
	}
}

lift_ground
{
	
	
	trigger move_ground_up
	{
		gotomarker pos_gr2 30 wait
		
		trigger crane move_left
	}
	
	trigger move_ground_left
	{
		gotomarker pos_gr3 50 wait
		
		trigger krane_sound hook_stop
				
		trigger crane move_down_left
    }
	
	trigger move_ground_right
	{
		gotomarker pos_gr2 50 wait
		
		trigger crane move_down
	}
	
	trigger move_ground_down
	{
		gotomarker pos_gr1 30 wait
		
		trigger krane_sound crane_stop

        trigger horn horn_end
	}
	
	trigger move_ground_down_left
	{
		gotomarker pos_gr4 30 wait
		
		trigger crane move_up_left
		
		
	}
	
	trigger move_ground_up_left
	{
		gotomarker pos_gr3 30 wait
		
		trigger crane move_right
		
	}
}


muni
{
	trigger up 
	{
		gotomarker pos_mu1 30
	}
	
	trigger left
	{
		gotomarker pos_mu2 50
	}
	
	trigger down
	{
		gotomarker pos_mu3 30 wait
		setstate muni invisible
	}

	
}

lift_st1
{
	
	
	trigger move_st1_up
	{
		gotomarker pos12 30 wait
	}
	trigger move_st1_left
	{
		gotomarker pos22 50 wait
	}
	
	trigger move_st1_right
	{
		gotomarker pos12 50 wait
	}
	
	trigger move_st1_down
	{
		gotomarker pos18 30 wait
	}
	
	trigger move_st1_down_left
	{
		gotomarker pos23 30 wait
	}
	
	trigger move_st1_up_left
	{
		gotomarker pos22 30 wait
	}
}

lift_st2
{
	
	
	trigger move_st2_up
	{
		gotomarker pos11 30 wait
		
	}
	
	trigger move_st2_left
	{
		gotomarker pos21 50 wait
	}
	
	trigger move_st2_right
	{
		gotomarker pos11 50 wait
	}
		
		
	trigger move_st2_down 
	{
		gotomarker pos17 30 wait
	}
	
	trigger move_st2_up_left
	{
		gotomarker pos21 30 wait
		
	}
	
	trigger move_st2_down_left 
	{
		gotomarker pos22 30 wait
	}
}

lift_st3
{
	
	
	trigger move_st3_up
	{
		gotomarker pos11 30 wait
		
		setstate lift_st3 invisible
		
	}
	
	trigger move_st3_down
	{
		setstate lift_st3 default
		gotomarker pos16 30 wait
	}
	
	
}

lift_st4
{
		
	trigger move_st4_up
	{
		gotomarker pos11 30 wait
		
		setstate lift_st4 invisible
	}
	
	
	trigger move_st4_down
	{
		setstate lift_st4 default
		
		gotomarker pos15 30 wait
	}
}

lift_st5
{
	
	
	trigger move_st5_up
	{
		gotomarker pos11 30 wait
		
		setstate lift_st5 invisible
	}
		
	trigger move_st5_down
	{
		gotomarker pos14 30 wait
		
		setstate lift_st5 default
	}
}

lift_st6
{
		
	trigger move_st6_up
	{
		gotomarker pos11 30 wait
		
		setstate lift_st6 invisible
	}
		
	trigger move_st6_down
	{
		setstate lift_st6 default
		
		gotomarker pos13 30 wait
	}
}

lift_st7
{
	
	
	trigger move_st7_up
	{
		gotomarker pos11 30 wait
		
		setstate lift_st7 invisible
	}
	
	
	trigger move_st7_down
	{
		setstate lift_st7 default
		
		gotomarker pos12 30 wait
	}
}

liftsteering
{
}

liftsteering_toi
{
}

// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================

allied_compost_built
{
	spawn
	{
		wait 400
		trigger allied_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
	}

	buildstart final
	{
		setstate allied_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate allied_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger allied_compost_built_model enable_allied_features
		
		
		enablespeaker allies_compost_sound
		
	}

	decayed final
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate allied_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger allied_compost_built_model disable_allied_features
		
		

		disablespeaker allies_compost_sound
		
	}
}

allied_compost_built_model
{
	spawn
	{
		wait 400
		setstate allied_compost_built_model invisible
	}

	trigger enable_allied_features
	{
		setchargetimefactor 1 soldier 0.75
		setchargetimefactor 1 lieutenant 0.75
		setchargetimefactor 1 medic 0.75
		setchargetimefactor 1 engineer 0.75
		setchargetimefactor 1 covertops 0.75
		sethqstatus 1 1
		
		wm_objective_status 6 0 2
		wm_objective_status 6 1 1

		wm_announce	"Allied Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

		wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		
	}

	trigger disable_allied_features
	{
		setchargetimefactor 1 soldier 1
		setchargetimefactor 1 lieutenant 1
		setchargetimefactor 1 medic 1
		setchargetimefactor 1 engineer 1
		setchargetimefactor 1 covertops 1
		sethqstatus 1 0
		
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0

		wm_announce	"Axis team has destroyed the Allied Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
		// *---------------------------------------------------------------------------------*
		
	}
}

axis_compost_built
{
	spawn
	{
		wait 400
		trigger axis_compost_built setup

		constructible_class 2
	}

	trigger setup
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
	}

	buildstart final
	{
		setstate axis_compost_built_model underconstruction
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible
	}

	built final
	{
		setstate axis_compost_built_model default
		setstate neutral_compost_closed_clip invisible
		setstate neutral_compost_closed_model invisible

		trigger axis_compost_built_model enable_axis_features

		enablespeaker axis_compost_sound
		
	}

	decayed final
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default
	}

	death
	{
		setstate axis_compost_built_model invisible
		setstate neutral_compost_closed_clip default
		setstate neutral_compost_closed_model default

		trigger axis_compost_built_model disable_axis_features

		disablespeaker axis_compost_sound
		
	}
}

axis_compost_built_model
{
	spawn
	{
		wait 400
		setstate axis_compost_built_model invisible
	}

	trigger enable_axis_features
	{
		setchargetimefactor 0 soldier 0.75
		setchargetimefactor 0 lieutenant 0.75
		setchargetimefactor 0 medic 0.75
		setchargetimefactor 0 engineer 0.75
		setchargetimefactor 0 covertops 0.75
		sethqstatus 0 1
		
		wm_objective_status 7 0 1
		wm_objective_status 7 1 2

		wm_announce	"Axis Command Post constructed. Charge speed increased!"

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

		wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

		wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		
	}

	trigger disable_axis_features
	{
		setchargetimefactor 0 soldier 1
		setchargetimefactor 0 lieutenant 1
		setchargetimefactor 0 medic 1
		setchargetimefactor 0 engineer 1
		setchargetimefactor 0 covertops 1
		sethqstatus 0 0
		
		wm_objective_status 7 0 0
		wm_objective_status 7 1 0

		wm_announce	"Allied team has destroyed the Axis Command Post!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*

		
	}
}